package com.Method;

/***
 * @ClassName: MyMethod
 * @Description:
 * @Auther: 送一一块二向箔
 * @Date: 10:12 2022/1/25
 * @version : V1.0
 */
public class MyMethod {

    public static void main(String[] args) {
        MyMethod myMethod = new MyMethod();
        myMethod.addMethod();
        myMethod.addMethod("大家好");
        myMethod.addMethod("hello world",1,2,34,6,7,45,6);
    }

    //可变参数
    void addMethod(String a,int ... b) {
        StringBuffer stringBuffer = new StringBuffer("您输入的字符串是——————》");
        stringBuffer.append(a);
        stringBuffer.append("宁输入的数字和为：");
        int sum = 0;
        for (int i = 0; i < b.length; i++) {
            sum +=b[i];
        }
        System.out.println(stringBuffer.append(sum).toString());
    }
    void addMethod(String a) {
        StringBuffer stringBuffer = new StringBuffer("您输入的字符串是——————》");
        stringBuffer.append(a);
        stringBuffer.append("没有输入数字");
        System.out.println(stringBuffer);
    }
    void addMethod() {
        System.out.println("你没有输入任何字符");
    }
}
